#include<reg51.h>
#define uchar unsigned char
	
uchar code dispcode[10]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
void delay();

main()
{
 uchar i;
 while(1)
 {
	 for(i=0;i<=9;i++)
	 {
		 P1=0x00; //数码管清零操作
		 P1=dispcode[i]; //依次取dispcode数组里0~9的数字编码
		 delay(); //延时，让数码管显示一段时间
	 }
 }
}

void delay()
{
	uchar i, j;
	for(i=0;i<200;i++)
		for(j=0;j<250;j++);
}